package com.enoram.training1;
import java.util.ArrayList;
import java.util.List;

public class Office extends BaseDomain{
	
	private String officeName;
	private Address address;
	private String phone;
	private String fax;
	private String email;
	
	private List<Officer> officers = new ArrayList<Officer>();
	
	public List<Officer> getOfficers() {
		return officers;
	}

	public void setOfficers(List<Officer> officers) {
		this.officers = officers;
	}

	//no need to set the initial value for collection. JDK is good enough with default value.
	private ArrayList<Officer> officerList = new ArrayList<Officer>();
	
	public Office(){
		super();
	}
	
	public Office(String name, Address address, String phone, String fax, String email){
		this.officeName = name;
		this.address = address;
		this.phone = phone;
		this.fax = fax;
		this.email =email;
	}
	
	public void addOfficer(String lastName, String firstName, String middleName, String email, User user){
		Officer officer = new Officer(lastName, firstName, middleName, email, user);
		officerList.add(officer);
		
	}
	
	public void addOfficer(Officer officer){
		officer.setOffice(this);
		officers.add(officer);
	}
	
	public String getOfficeName(){
		System.out.println("Office Name: "+ officeName);
		return officeName;
	}
	
	public Address getAddress(){
		return address;
	}
	
	public int getOfficerID(int indexNum){
		Officer officerID = officerList.get(indexNum);
		int id = officerID.getId();
		System.out.println("ID: " + id);
		return id;
	}
	
	public String getOfficerName(int indexNum){
		Officer officerName = officerList.get(indexNum);
		String name = officerName.getName();
		System.out.println("Name: " + name);
		return name;
	}
	
	
	public void getOfficerInfo(int indexNum){
		Officer officerInfo = officerList.get(indexNum);
		System.out.println(officerInfo.getId() + " " + officerInfo.getName());
	}
	
	public int numOfOfficer(){
		System.out.println("Size: " + officerList.size());
		return officerList.size();
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getFax() {
		return fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public void setOfficeName(String officeName) {
		this.officeName = officeName;
	}

	public void setAddress(Address address) {
		this.address = address;
	}



}
